# - Try to locate SDL2
# This module defines:
#
#  SDL2_INCLUDE_DIR
#  SDL2_LIBRARY, SDL2MAIN_LIBRARY
#  SDL2_FOUND
#

FIND_PATH(SDL2_INCLUDE_DIR NAMES SDL.h PATH_SUFFIXES SDL2)

FIND_LIBRARY(SDL2_LIBRARY NAMES SDL2)
FIND_LIBRARY(SDL2MAIN_LIBRARY NAMES SDL2main)

INCLUDE(FindPackageHandleStandardArgs)

IF (UNIX)
	# Fedora has reportedly dropped SDLmain, so don't treat it as mandatory on *nix
	FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
ELSE (UNIX)
	FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2MAIN_LIBRARY SDL2_INCLUDE_DIR)
ENDIF (UNIX)

MARK_AS_ADVANCED(SDL2_INCLUDE_DIR SDL2_LIBRARY SDL2MAIN_LIBRARY)
